]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
authPrompt: Manually destroy inactive/unused entry
authorSebastian Keller <skeller@gnome.org>
Sun, 12 Feb 2023 17:13:59 +0000 (18:13 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sun, 12 Feb 2023 20:02:34 +0000 (20:02 +0000)
AuthPrompt creates two entries, one for text and one for passwords, but
only ever one is used as child widget. This would lead to the other one
not getting destroyed when the the AuthPrompt is destroyed.

This now manually destroys the inactive one when the AuthPrompt is
destroyed to avoid that leak.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6395
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2637>

js/gdm/authPrompt.js

index 97b12ef54389080e733f4b97d69e96576f5b1aee..e48e422fa72d0af531ab993d77b4a3e88e965944 100644 (file)
@@ -120,6 +120,8 @@ var AuthPrompt = GObject.registerClass({
     }
 
     _onDestroy() {
+        this._inactiveEntry.destroy();
+        this._inactiveEntry = null;
         this._userVerifier.destroy();
         this._userVerifier = null;
     }
@@ -189,6 +191,7 @@ var AuthPrompt = GObject.registerClass({
         this._entry = this._passwordEntry;
         this._mainBox.add_child(this._entry);
         this._entry.grab_key_focus();
+        this._inactiveEntry = this._textEntry;
 
         this._timedLoginIndicator = new St.Bin({
             style_class: 'login-dialog-timed-login-indicator',
@@ -278,9 +281,11 @@ var AuthPrompt = GObject.registerClass({
         if (secret && this._entry !== this._passwordEntry) {
             this._mainBox.replace_child(this._entry, this._passwordEntry);
             this._entry = this._passwordEntry;
+            this._inactiveEntry = this._textEntry;
         } else if (!secret && this._entry !== this._textEntry) {
             this._mainBox.replace_child(this._entry, this._textEntry);
             this._entry = this._textEntry;
+            this._inactiveEntry = this._passwordEntry;
         }
         this._capsLockWarningLabel.visible = secret;
     }